/**
 * @file
 * @brief   网络命令类定义文件。
 * @author  赵一
 * @date    2012/08/01
 * @version 0.1
 */

#include "NetController.h"
#include "CommonHelper.h"

#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS

#import "AMFCaller.h"
#include "../model/proxy/DungeonsProxy.h"
#include "../Model/proxy/UserProxy.h"
#include "../Model/proxy/ItemProxy.h"
#include "../Model/proxy/FightProxy.h"
#include "../Model/proxy/ChanllengeProxy.h"
#include "CommonHelper.h"

/**
 * @brief 构造函数。
 * @note  初始化内部变量。
 */
NetController::NetController()
    : mPlatform(-1)
    , mGid(-1)
{
    NSLog(@"NetController::NetController() start");

    NSLog(@"NetController::NetController() end");
}

/**
 * @brief 析构函数。
 */
NetController::~NetController()
{
    NSLog(@"NetController::~NetController() start");

    NSLog(@"NetController::~NetController() end");
}

/**
 * @brief     初始化函数。
 * @param[in] url   服务器地址URL。
 * @return    true  成功。
 * @return    false 失败。
 * @note      初始化网络命令参数。
 */
bool NetController::init(const char* url)
{
    NSLog(@"NetController::init() start");

    bool result = false;

    if (url != nil)
    {
        NSLog(@"NetController::init(): url: %s", url);

        [[AMFCaller shared] setURL:[NSString stringWithFormat:@"%s", url]];
        mPlatform = _getPlatform();
        mPid = _getPid();
        mVersion = _getVersion();

        result = true;
    }
    else
    {
        NSLog(@"NetController::init(): paramater url is null.");
    }

    NSLog(@"NetController::init() end");

    return result;
}

/**
 * @brief     数据解析函数。
 * @param[in] data 接收到的数据。
 * @note      解析数据包的基础信息，并根据命令名称进行命令分解调用。(用于网络接口回调使用)
 */
void NetController::parseData(void* data)
{
    NSLog(@"NetController::parseData() start");

    NSDictionary *dict = (NSDictionary*)data;
    if ((dict != nil)
        && (![dict isEqual:[NSNull null]])
        && (![dict isEqual:@""]))
    {
        //取得命令版本信息
        NSString* version = [dict objectForKey:@"version"];

        NSLog(@"version: %@", version);

        NSDictionary* result = [((NSArray*)[dict objectForKey:@"result"]) objectAtIndex:0];
        if ((result != nil)
            && (![result isEqual:[NSNull null]])
            && (![result isEqual:@""]))
        {
            //取得命令名称
            NSString* cmd = [result objectForKey:@"cmd"];
            if ((cmd != nil)
                && (![cmd isEqual:[NSNull null]])
                && (![cmd isEqual:@""]))
            {
                //取得命令名称
                string cmdName = [cmd UTF8String];

                //取得结果状态（0：命令执行成功。1：命令执行出错）
                int status = [[result objectForKey:@"status"] intValue];
                switch (status)
                {
                case 1:
                    {
                        int errorCode = [[result objectForKey:@"__code"] intValue];
                        NSString* errorMessage = [result objectForKey:@"__message"];
                        NSString* errorLine = [result objectForKey:@"__line"];

                        NSLog(@"errorCode: %i", errorCode);
                        NSLog(@"errorMessage: %@", errorMessage);
                        NSLog(@"errorLine: %@", errorLine);

                        _parseError(cmdName, errorCode);
                    }
                    break;

                case 0:
                    {
                        //取得返回数据
                        NSObject* realData = [result objectForKey:@"data"];

                        //调用解析处理
                        if (cmdName == kNCGameInit)
                        {
                            _parseGameInit((void*)realData);
                        }
                        else if (cmdName == kNCGameLoad)
                        {
                            _parseGameLoad((void*)realData);
                        }
                        else if (cmdName == kNCRegist)
                        {
                            _parseRegist((void*)realData);
                        }
                        else if (cmdName == kNCGetSelfInfo)
                        {
                            _parseGetSelfInfo((void*)realData);
                        }
                        else if (cmdName == kNCGetInfo)
                        {
                            _parseGetInfo((void*)realData);
                        }
                        else if (cmdName == kNCDungeonExplore)
                        {
                            _parseDungeonExplore((void*)realData);
                        }
                        else if (cmdName == kNCAllotProficiency)
                        {
                            _parseAllotProficiency((void*)realData);
                        }
                        else if (cmdName == kNCLoadEquipage)
                        {
                            _parseLoadEquipage((void*)realData);
                        }
                        else if (cmdName == kNCSellEquipage)
                        {
                            _parseSellEquipage((void*)realData);
                        }
                        else if (cmdName == kNCUnloadEquipage)
                        {
                            _parseUnloadEquipage((void*)realData);
                        }
                        else if (cmdName == kNCResetEquipage)
                        {
                            _parseResetEquipage((void*)realData);
                        }
                        else if (cmdName == kNCFusionEquipage)
                        {
                            _parseFusionEquipage((void*)realData);
                        }
                        else if (cmdName == kNCIntensifyEquipage)
                        {
                            _parseIntensifyEquipage((void*)realData);
                        }
                        else if (cmdName == kNCGetChallengeList)
                        {
                            _parseGetChallengeList((void*)realData);
                        }
                        else if (cmdName == kNCChallengePlayer)
                        {
                            _parseChallengePlayer((void*)realData);
                        }
                        else if (cmdName == kNCFindChallengePlayer) {
                            _parseFindChallengePlayer((void*)realData);
                        }
                        else if (cmdName == kNCGetChallengeEnemyList) {
                            _parseGetChallengeEnemyList((void*)realData);
                        }
                        else {
                            //TODO: 解析出错
                            NSLog(@"NetController::parseData(): unknow cmdName.");
                        }
                    }
                    break;

                default:
                    {
                        //TODO: 解析出错
                        NSLog(@"NetController::parseData(): unknow status.");
                    }
                    break;
                }
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::parseData(): cmd is null.");
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::parseData(): result is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::parseData(): dict is null.");
    }

    NSLog(@"NetController::parseData() end");
}

/**
 * @brief 网络错误处理函数。
 * @note  解析网络错误信息。(用于网络接口回调使用)
 */
void NetController::receiveError()
{
    NSLog(@"NetController::receiveError() start");

    //TODO: 网络错误处理

    NSLog(@"NetController::receiveError() end");
}

/**
 * @brief  游戏初始化命令函数。
 * @return true  成功。
 * @return false 失败。
 * @note   发送游戏初始化命令到服务器。
 */
bool NetController::gameInit()
{
    NSLog(@"NetController::gameInit() start");
    NSLog(@"NetController::gameInit() end");

    return _sendCommand(kNCGameInit, nil);
}

/**
 * @brief  游戏加载命令函数。
 * @return true  成功。
 * @return false 失败。
 * @note   发送游戏加载命令到服务器。
 */
bool NetController::gameLoad()
{
    //TODO: 未完成

    return _sendCommand(kNCGameLoad, nil);
}

/**
 * @brief     注册命令函数。
 * @param[in] name  用户名称。
 * @param[in] avata 用户形象。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送注册命令到服务器。
 */
bool NetController::regist(const std::string& name, const int avata)
{
    NSLog(@"NetController::regist() start");
    NSLog(@"NetController::regist(): name: %s", name.c_str());
    NSLog(@"NetController::regist(): avata: %i", avata);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSString stringWithFormat:@"%s", name.c_str()], @"name",
                               [NSNumber numberWithInt:avata], @"avata",
                               nil];

    NSLog(@"NetController::regist() end");

    //命令发送
    return _sendCommand(kNCRegist, params);
}

/**
 * @brief  取得自己的用户信息命令函数。
 * @return true  成功。
 * @return false 失败。
 * @note   发送取得用户信息命令到服务器。
 */
bool NetController::getSelfInfo()
{
    NSLog(@"NetController::getSelfInfo() start");
    NSLog(@"NetController::getSelfInfo() end");

    //命令发送
    return _sendCommand(kNCGetSelfInfo, nil);
}

/**
 * @brief     取得指定的用户信息命令函数。
 * @param[in] gid   用户gid。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送取得用户信息命令到服务器。
 */
bool NetController::getInfo(int gid)
{
    NSLog(@"NetController::getInfo() start");
    NSLog(@"NetController::getInfo(): gid: %i", gid);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:gid], @"gid",
                               nil];

    NSLog(@"NetController::getInfo() end");

    //命令发送
    return _sendCommand(kNCGetInfo, params);
}

/**
 * @brief     地下城探险命令函数。
 * @param[in] dungeon 地下城ID。
 * @param[in] floor   地下城层级ID。(地下城中的子ID)
 * @param[in] task    地下城任务ID。(层级中的子ID)
 * @return    true    成功。
 * @return    false   失败。
 * @note      发送地下城探险命令到服务器。
 */
bool NetController::dungeonExplore(int dungeon, int floor, int task)
{
    NSLog(@"NetController::dungeonExplore() start");
    NSLog(@"NetController::dungeonExplore(): dungeon: %i", dungeon);
    NSLog(@"NetController::dungeonExplore(): floor: %i", floor);
    NSLog(@"NetController::dungeonExplore(): task: %i", task);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:dungeon], @"dungeon",
                               [NSNumber numberWithInt:floor], @"floor",
                               [NSNumber numberWithInt:task], @"task",
                               nil];

    NSLog(@"NetController::dungeonExplore() end");

    //命令发送
    return _sendCommand(kNCDungeonExplore, params);
}

/**
 * @brief     潜能点分配命令函数。
 * @param[in] energyCur 向用户当前能量值中所追加分配的潜能点。
 * @param[in] life      向用户生命值中所追加分配的潜能点。
 * @return    true      成功。
 * @return    false     失败。
 * @note      发送潜能点分配命令到服务器。
 */
bool NetController::allotProficiency(int energyCur, int life)
{
    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:energyCur], @"energyCur",
                               [NSNumber numberWithInt:life], @"life",
                               nil];

    //命令发送
    return _sendCommand(kNCAllotProficiency, params);
}

/**
 * @brief     加载装备命令函数。
 * @param[in] index 装备在用户背包中的索引。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送加载装备命令到服务器。
 */
bool NetController::loadEquipage(int index)
{
    NSLog(@"NetController::loadEquipage() start");
    NSLog(@"NetController::loadEquipage(): index: %i", index);
    
    ItemProxy::getSingletonPtr()->putonIndex = index;

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:index], @"index",
                               nil];

    NSLog(@"NetController::loadEquipage() end");

    //命令发送
    return _sendCommand(kNCLoadEquipage, params);
}

/**
 * @brief     卸载装备命令函数。
 * @param[in] index 装备在用户背包中的索引。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送卸载装备命令到服务器。
 */
bool NetController::unloadEquipage(int index)
{
    NSLog(@"NetController::unloadEquipage() start");
    NSLog(@"NetController::unloadEquipage(): index: %i", index);

    ItemProxy::getSingletonPtr()->putonIndex = index;
    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:index], @"index",
                               nil];

    NSLog(@"NetController::unloadEquipage() end");

    //命令发送
    return _sendCommand(kNCUnloadEquipage, params);
}

/**
 * @brief     贩卖装备命令函数。
 * @param[in] index 装备在用户背包中的索引。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送贩卖装备命令到服务器。
 */
bool NetController::sellEquipage(std::vector<int>& indexArray)
{
    NSLog(@"NetController::sellEquipage() start");

    //转换装备在用户背包中的索引数组
    NSMutableArray* indexList = [[NSMutableArray alloc] init];

    for (std::vector<int>::iterator itr=indexArray.begin(); itr!=indexArray.end(); itr++) {
        int index = *itr;
        [indexList addObject:[NSNumber numberWithInt:index]];
    }

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               indexList, @"index",
                               nil];

    NSLog(@"NetController::sellEquipage() end");

    //命令发送
    return _sendCommand(kNCSellEquipage, params);
}


/**
 * @brief     洗练装备命令函数。
 * @param[in] index 装备在用户背包中的索引。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送洗练装备命令到服务器。
 */
bool NetController::resetEquipage(int index)
{
    NSLog(@"NetController::resetEquipage() start");
    NSLog(@"NetController::resetEquipage(): index: %i", index);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:index], @"index",
                               nil];

    NSLog(@"NetController::resetEquipage() end");

    //命令发送
    return _sendCommand(kNCResetEquipage, params);
}

/**
 * @brief     熔炼装备命令函数。
 * @param[in] indexArray 装备在用户背包中的索引数组。
 * @return    true       成功。
 * @return    false      失败。
 * @note      发送熔炼装备命令到服务器。
 */
bool NetController::fusionEquipage(std::vector<int>& indexArray)
{
    NSLog(@"NetController::fusionEquipage() start");

    //转换装备在用户背包中的索引数组
    NSMutableArray* indexList = [[NSMutableArray alloc] init];

    for (std::vector<int>::iterator itr=indexArray.begin(); itr!=indexArray.end(); itr++) {
        int index = *itr;
        [indexList addObject:[NSNumber numberWithInt:index]];
        NSLog(@"NetController::intensifyEquipage(): index: %i", index);
    }

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               indexList, @"index",
                               nil];

    NSLog(@"NetController::fusionEquipage() end");

    //命令发送
    return _sendCommand(kNCFusionEquipage, params);
}

/**
 * @brief     强化装备命令函数。
 * @param[in] index  装备在用户背包中的索引。
 * @param[in] number 助溶剂数量。
 * @return    true   成功。
 * @return    false  失败。
 * @note      发送熔炼装备命令到服务器。
 */
bool NetController::intensifyEquipage(int index, int number)
{
    NSLog(@"NetController::intensifyEquipage() start");
    NSLog(@"NetController::intensifyEquipage(): index: %i", index);
    NSLog(@"NetController::intensifyEquipage(): number: %i", number);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithInt:index], @"index",
                               [NSNumber numberWithInt:number], @"number",
                               nil];

    NSLog(@"NetController::intensifyEquipage() end");

    //命令发送
    return _sendCommand(kNCIntensifyEquipage, params);
}

/**
 * @brief     搜素需要挑战的玩家命令函数
 * @param[in] name  需要挑战的玩家名称。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送搜素需要挑战的玩家命令到服务器。
 */
bool NetController::findChallengePlayer(const std::string& name)
{
    NSLog(@"NetController::findChallengePlayer() start");
    NSLog(@"NetController::findChallengePlayer(): name: %s", name.c_str());

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSString stringWithFormat:@"%s", name.c_str()], @"name",
                            nil];

    NSLog(@"NetController::findChallengePlayer() end");
    
    //命令发送
    return _sendCommand(kNCFindChallengePlayer, params);
}

/**
 * @brief  获取挑战玩家列表命令函数。
 * @return true  成功。
 * @return false 失败。
 * @note   发送请求挑战玩家列表命令到服务器。
 */
bool NetController::getChallengeList()
{
    NSLog(@"NetController::getChallengeList() start");

    NSLog(@"NetController::getChallengeList() end");

    //命令发送
    return _sendCommand(kNCGetChallengeList, nil);
}

/**
 * @brief  请求宿敌列表命令函数。
 * @return true  成功。
 * @return false 失败。
 * @note   发送请求宿敌列表命令到服务器。
 */
bool NetController::getChallengeEnemyList()
{
    NSLog(@"NetController::getGetChallengeEnemyList() start");

    NSLog(@"NetController::getGetChallengeEnemyList() end");

    //命令发送
    return _sendCommand(kNCGetChallengeEnemyList, nil);
}

/**
 * @brief     挑战玩家命令函数。
 * @param[in] gid  对手的gid。
 * @note      发送挑战对手命令到服务器。
 */
bool NetController::challengePlayer(const int gid)
{
    NSLog(@"NetController::challengePlayer() start");
    NSLog(@"NetController::challengePlayer(): gid: %i", gid);

    //将参数进行组合
    NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSNumber numberWithInt:gid], @"gid",
                            nil];

    NSLog(@"NetController::challengePlayer() end");

    //命令发送
    return _sendCommand(kNCChallengePlayer, params);
}

/**
 * @brief     发送网络命令函数。
 * @param[in] cmd   命令名称。
 * @param[in] data  命令数据。
 * @return    true  成功。
 * @return    false 失败。
 * @note      发送网络命令到服务器。(对外发布的命令发送接口的共同私有接口)
 */
bool NetController::_sendCommand(const string& cmd, void* params)
{
    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
    bool result = false;

    //TODO: 测试程序 start
//    mGid = 2;
    //TODO: 测试程序 end

    if ((mPlatform != -1)
        || (mGid != -1))
    {
        //命令组装
        NSString* command = [NSString stringWithFormat:@"%s", cmd.c_str()];
        NSDictionary* cmdParams = (NSDictionary*)params;
        NSDictionary* dataItem;
        //命令以及参数进行组合
        if (cmdParams != nil)
        {
            dataItem = [NSDictionary dictionaryWithObjectsAndKeys:
                           command, @"cmd",
                           params, @"params",
                           nil];
        }
        else
        {
            dataItem = [NSDictionary dictionaryWithObjectsAndKeys:
                           command, @"cmd",
                           nil];
        }
        NSArray* data = [NSArray arrayWithObject:dataItem];
        NSDictionary* arguments = [NSDictionary dictionaryWithObjectsAndKeys:
                                      data, @"data",
                                      [NSString stringWithFormat:@"%s", mPid.c_str()], @"pid",
                                      [NSString stringWithFormat:@"%s", mVersion.c_str()], @"version",
                                      [NSNumber numberWithInt:mGid], @"gid",
                                      [NSNumber numberWithInt:mPlatform], @"platform",
                                      nil];
        NSArray* package = [NSArray arrayWithObject:arguments];

        //发送命令
        [[AMFCaller shared] sendPackage:package];

        result = true;
    }

    [pool release];

    return result;
}

/**
 * @brief      服务器处理错误函数。
 * @param[in]  cmd 命令。
 * @param[out] error 错误代码。
 */
void NetController::_parseError(std::string cmd, int error)
{
    NSLog(@"NetController::_parseError() start");

    //TODO: 网络命令错误处理

    NSLog(@"NetController::_parseError() start");
}

/**
 * @brief     游戏初始化命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGameInit(void* params)
{
    NSLog(@"NetController::_parseGameInit() start");

    CCObject* postData;

    NSDictionary* data = (NSDictionary*)params;
    if (data != nil)
    {
        //取得游戏初始化结果
        NSNumber* result = [data objectForKey:@"result"];
        int initResult = [result intValue];
        switch (initResult) {
        case 1:
            //TODO: 玩家帐户已经存在
            getSelfInfo();
            break;
        case 2:
            //TODO: 玩家不存在
            regist("lance", 1);
            break;
        default:
            //TODO: 未知结果
            break;
        }

        Post_Net_Notification(kNCGameInit, postData);
    }

    NSLog(@"NetController::_parseGameInit() end");
}

/**
 * @brief     游戏加载命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGameLoad(void* params)
{
    CCObject* postData;

    NSDictionary* data = (NSDictionary*)params;
    if (data != nil)
    {
        //TODO: 未完成

        Post_Net_Notification(kNCGameLoad, postData);
    }
}

/**
 * @brief     注册命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseRegist(void* params)
{
    NSLog(@"NetController::_parseRegist() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        _getSelfInfo(data);
        //TODO: 第二个参数是否可以强制转换传递？
        Post_Net_Notification(kNCRegist, NULL);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseRegist(): data is null.");
    }

    NSLog(@"NetController::_parseRegist() end");
}

/**
 * @brief     取得用户信息命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGetSelfInfo(void* params)
{
    NSLog(@"NetController::_parseGetSelfInfo() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        _getSelfInfo(data);
        Post_Net_Notification(kNCGetSelfInfo, NULL);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseGetSelfInfo(): data is null.");
    }

    NSLog(@"NetController::_parseGetSelfInfo() end");
}

/**
 * @brief     取得用户信息命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGetInfo(void* params)
{
    NSLog(@"NetController::_parseGetInfo() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSDictionary* player = [data objectForKey:@"player"];
        if ((player != nil)
            && (![player isEqual:[NSNull null]])
            && (![player isEqual:@""]))
        {
            //验证信息
            NSNumber* gid = [player objectForKey:@"gid"];
            NSString* pid = [player objectForKey:@"pid"];
            NSNumber* platform = [player objectForKey:@"platform"];

            NSLog(@"gid: %@", gid);
            NSLog(@"pid: %@", pid);
            NSLog(@"platform: %@", platform);

            //时间信息
            NSNumber* createTime = [player objectForKey:@"createTime"];
            NSNumber* energyTime = [player objectForKey:@"energyTime"];
            NSNumber* powerTime = [player objectForKey:@"powerTime"];

            NSLog(@"createTime: %@", createTime);
            NSLog(@"energyTime: %@", energyTime);
            NSLog(@"powerTime: %@", powerTime);

            //基础信息
            NSString* name = [player objectForKey:@"name"];
            NSString* sex = [player objectForKey:@"sex"];
            NSNumber* avata = [player objectForKey:@"avata"];
            NSNumber* level = [player objectForKey:@"level"];
            NSNumber* exp = [player objectForKey:@"exp"];

            NSLog(@"name: %@", name);
            NSLog(@"sex: %@", sex);
            NSLog(@"avata: %@", avata);
            NSLog(@"level: %@", level);
            NSLog(@"exp: %@", exp);

            //金融信息
            NSNumber* coin = [player objectForKey:@"coin"];
            NSNumber* money = [player objectForKey:@"money"];

            NSLog(@"coin: %@", coin);
            NSLog(@"money: %@", money);

            //能力信息
            NSNumber* energyCur = [player objectForKey:@"energyCur"];
            NSNumber* energyMax = [player objectForKey:@"energyMax"];
            NSNumber* powerCur = [player objectForKey:@"powerCur"];
            NSNumber* powerMax = [player objectForKey:@"powerMax"];
            NSNumber* life = [player objectForKey:@"life"];
            NSNumber* proficiency = [player objectForKey:@"proficiency"];
            NSNumber* fusion = [player objectForKey:@"fusion"];

            NSLog(@"energyCur: %@", energyCur);
            NSLog(@"energyMax: %@", energyMax);
            NSLog(@"powerCur: %@", powerCur);
            NSLog(@"powerMax: %@", powerMax);
            NSLog(@"life: %@", life);
            NSLog(@"proficiency: %@", proficiency);
            NSLog(@"fusion: %@", fusion);

            //对战信息
            NSNumber* atkMin = [player objectForKey:@"atkMin"];
            NSNumber* atkMax = [player objectForKey:@"atkMax"];
            NSNumber* defMin = [player objectForKey:@"defMin"];
            NSNumber* defMax = [player objectForKey:@"defMax"];
            NSNumber* atkMaxReappear = [player objectForKey:@"atkMaxReappear"];
            NSNumber* defMaxReappear = [player objectForKey:@"defMaxReappear"];
            NSNumber* expGainRatio = [player objectForKey:@"expGainRatio"];
            NSNumber* coinGainRatio = [player objectForKey:@"coinGainRatio"];
            NSNumber* equipageDropRatio = [player objectForKey:@"equipageDropRatio"];
            NSNumber* energyRecoverRatio = [player objectForKey:@"energyRecoverRatio"];
            NSNumber* powerRecoverRatio = [player objectForKey:@"powerRecoverRatio"];

            NSLog(@"atkMin: %@", atkMin);
            NSLog(@"atkMax: %@", atkMax);
            NSLog(@"defMin: %@", defMin);
            NSLog(@"defMax: %@", defMax);
            NSLog(@"atkMaxReappear: %@", atkMaxReappear);
            NSLog(@"defMaxReappear: %@", defMaxReappear);
            NSLog(@"expGainRatio: %@", expGainRatio);
            NSLog(@"coinGainRatio: %@", coinGainRatio);
            NSLog(@"equipageDropRatio: %@", equipageDropRatio);
            NSLog(@"energyRecoverRatio: %@", energyRecoverRatio);
            NSLog(@"powerRecoverRatio: %@", powerRecoverRatio);

            //装备背包信息
            NSNumber* equipageBagItemMax = [player objectForKey:@"equipageBagItemMax"];
            NSNumber* equipageBagItemCurID = [player objectForKey:@"equipageBagItemCurID"];
            NSArray* equipageBagItemArray = [player objectForKey:@"equipageBagItemArray"];
            if ((equipageBagItemArray != nil)
                && (![equipageBagItemArray isEqual:[NSNull null]])
                && (![equipageBagItemArray isEqual:@""]))
            {
                int count = [equipageBagItemArray count];
                for (int i=0; i<count; i++)
                {
                    NSArray* equipage = [equipageBagItemArray objectAtIndex:i];
                    if ((equipage != nil)
                        && (![equipage isEqual:[NSNull null]])
                        && (![equipage isEqual:@""]))
                    {
                        NSNumber* equipageIndex = [equipage objectAtIndex:kNCBagEquipageFieldIndex];
                        NSNumber* equipageID = [equipage objectAtIndex:kNCBagEquipageFieldBaseID];
                        NSNumber* equipageLevel = [equipage objectAtIndex:kNCBagEquipageFieldLevel];
                        NSNumber* equipageExp = [equipage objectAtIndex:kNCBagEquipageFieldExp];
                        NSNumber* equipageAtkMin = [equipage objectAtIndex:kNCBagEquipageFieldAtkMin];
                        NSNumber* equipageAtkMax = [equipage objectAtIndex:kNCBagEquipageFieldAtkMax];
                        NSNumber* equipageDefMin = [equipage objectAtIndex:kNCBagEquipageFieldDefMin];
                        NSNumber* equipageDefMax = [equipage objectAtIndex:kNCBagEquipageFieldDefMax];
                        NSNumber* equipageLife = [equipage objectAtIndex:kNCBagEquipageFieldLife];
                        NSNumber* equipageState = [equipage objectAtIndex:kNCBagEquipageFieldState];
                        NSNumber* equipageIntensifyNum = [equipage objectAtIndex:kNCBagEquipageFieldIntensifyNum];
                        NSNumber* equipageIntensifyValue = [equipage objectAtIndex:kNCBagEquipageFieldIntensifyValue];
                        NSArray* equipageExt = [equipage objectAtIndex:kNCBagEquipageFieldExt];
                        int count = [equipageExt count];
                        for (int j=0; j<count; j++) {
                            //TODO: 词条解析
                        }
                    }
                    else
                    {
                        //TODO: 解析出错
                        NSLog(@"NetController::_parseGetInfo(): equipage[%@] is null.", i);
                    }
                }
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::_parseGetInfo(): equipageBagItemArray is null.");
            }

            NSLog(@"equipageBagItemMax: %@", equipageBagItemMax);
            NSLog(@"equipageBagItemCurID: %@", equipageBagItemCurID);
            NSLog(@"equipageBagItemArray: %@", equipageBagItemArray);

            NSArray* propBagItemArray = [player objectForKey:@"propBagItemArray"];
            if ((propBagItemArray != nil)
                && (![propBagItemArray isEqual:[NSNull null]])
                && (![propBagItemArray isEqual:@""]))
            {
                int count = [propBagItemArray count];
                for (int i=0; i<count; i++)
                {
                    NSArray* prop = [propBagItemArray objectAtIndex:i];
                    if ((prop != nil)
                        && (![prop isEqual:[NSNull null]])
                        && (![prop isEqual:@""]))
                    {
                        NSNumber* propIndex = [prop objectAtIndex:kNCBagPropFieldIndex];
                        NSNumber* propID = [prop objectAtIndex:kNCBagPropFieldBaseID];
                        NSNumber* propNum = [prop objectAtIndex:kNCBagPropFieldNum];
                    }
                    else
                    {
                        //TODO: 解析出错
                        NSLog(@"NetController::_parseGetInfo(): prop[%@] is null.", i);
                    }
                }
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::_parseGetInfo(): propBagItemArray is null.");
            }

            NSLog(@"propBagItemArray: %@", propBagItemArray);

            NSDictionary* taskCur = [player objectForKey:@"taskCur"];
            if ((taskCur != nil)
                && (![taskCur isEqual:[NSNull null]])
                && (![taskCur isEqual:@""]))
            {
                NSArray* keys = [taskCur allKeys];
                for (int i=0; i<[keys count]; i++)
                {
                    NSNumber* key = [keys objectAtIndex:i];
                    NSArray* taskInfo = [taskCur objectForKey:key];

                    DungeonsProxy::getSingletonPtr()->curTaskInfo.dungeonID = [key intValue];
                    _parseTaskInfo(taskInfo, &(DungeonsProxy::getSingletonPtr()->curTaskInfo));
                }
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::_parseGetInfo(): taskCur is null.");
            }

            NSLog(@"taskCur: %@", taskCur);

            NSDictionary* taskMax = [player objectForKey:@"taskMax"];
            if ((taskMax != nil)
                && (![taskMax isEqual:[NSNull null]])
                && (![taskMax isEqual:@""]))
            {
                NSArray* keys = [taskMax allKeys];
                for (int i=0; i<[keys count]; i++)
                {
                    NSNumber* key = [keys objectAtIndex:i];
                    NSArray* taskInfo = [taskMax objectForKey:key];

                    DungeonsProxy::getSingletonPtr()->curTaskInfo.dungeonID = [key intValue];
                    _parseTaskInfo(taskInfo, &(DungeonsProxy::getSingletonPtr()->curTaskInfo));
                }
            }
            else{
                //TODO: 解析出错
                NSLog(@"NetController::_parseGetInfo(): taskMax is null.");
            }

            NSLog(@"taskMax: %@", taskMax);

            NSDictionary* challengeEnemyList = [player objectForKey:@"challengeEnemyList"];
            if ((challengeEnemyList != nil)
                && (![challengeEnemyList isEqual:[NSNull null]])
                && (![challengeEnemyList isEqual:@""]))
            {
                int count = [challengeEnemyList count];
                for (int i=0; i<count; i++)
                {
                    NSArray* enemy = [challengeEnemyList objectAtIndex:i];
                    if ((enemy != nil)
                        && (![enemy isEqual:[NSNull null]])
                        && (![enemy isEqual:@""]))
                    {
                        //TODO: 上层对应
                        _parseChallengeEnemyList(enemy, NULL);
                    }
                    else
                    {
                        //TODO: 解析出错
                        NSLog(@"NetController::_parseRegist(): enemy[%@] is null.", i);
                    }
                }
            }
            else{
                //TODO: 解析出错
                NSLog(@"NetController::_parseRegist(): challengeEnemyList is null.");
            }

            NSLog(@"challengeEnemyList: %@", challengeEnemyList);
        }

//        ItemProxy::getSingletonPtr()->addEquip(playerInfo.bagInfo.baginfo);
        //TODO: 第二个参数是否可以强制转换传递？
//        Post_Net_Notification(kNCGetInfo,   (CCObject*)&playerInfo);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseGetInfo(): data is null.");
    }

    NSLog(@"NetController::_parseGetInfo() end");
}

/**
 * @brief     地下城探险命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseDungeonExplore(void* params)
{
    NSLog(@"NetController::_parseDungeonExplore() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* result = [data objectForKey:@"result"];
        if ((result != nil)
            && (![result isEqual:[NSNull null]])
            && (![result isEqual:@""]))
        {
            NSLog(@"result: %@", result);

            int exploreResult = [result intValue];
            switch (exploreResult)
            {
            case 1:
                {
                    //探险成功
                    NSDictionary* taskInfo = [data objectForKey:@"task"];
                    if ((taskInfo != nil)
                        && (![taskInfo isEqual:[NSNull null]])
                        && (![taskInfo isEqual:@""]))
                    {
                        NSNumber* dungeon = [taskInfo objectForKey:@"dungeon"];
                        DungeonsProxy::getSingletonPtr()->curTaskInfo.dungeonID = [dungeon intValue];

                        NSLog(@"dungeon: %@", dungeon);

                        NSArray* taskCur = [taskInfo objectForKey:@"taskCur"];
                        if ((taskCur != nil)
                            && (![taskCur isEqual:[NSNull null]])
                            && (![taskCur isEqual:@""]))
                        {
                            _parseTaskInfo(taskCur,&(DungeonsProxy::getSingletonPtr()->curTaskInfo));
                        }
                        else
                        {
                            //TODO: 解析出错
                            NSLog(@"NetController::_parseDungeonExplore(): taskCur is null.");
                        }

                        NSLog(@"taskCur: %@", taskCur);

                        NSArray* taskMax = [taskInfo objectForKey:@"taskMax"];
                        if ((taskMax != nil)
                            && (![taskMax isEqual:[NSNull null]])
                            && (![taskMax isEqual:@""]))
                        {
                            _parseTaskInfo(taskMax, &(DungeonsProxy::getSingletonPtr()->maxTaskInfo));
                        }
                        else{
                            //TODO: 解析出错
                            NSLog(@"NetController::_parseDungeonExplore(): taskMax is null.");
                        }

                        NSLog(@"taskMax: %@", taskMax);
                    }
                    else
                    {
                        NSLog(@"NetController::_parseDungeonExplore(): taskInfo is null.");
                    }

                    FightProxy::getSingletonPtr()->awardInfo.clear();
                    NSDictionary* awardInfo = [data objectForKey:@"award"];
                    if ((awardInfo != nil)
                        && (![awardInfo isEqual:[NSNull null]])
                        && (![awardInfo isEqual:@""]))
                    {
                        NSNumber* exp = [awardInfo objectForKey:@"exp"];
                        NSNumber* coin = [awardInfo objectForKey:@"coin"];
                        FightProxy::getSingletonPtr()->awardInfo.exp = [exp intValue];
                        FightProxy::getSingletonPtr()->awardInfo.coin = [coin intValue];

                        NSLog(@"exp: %@", exp);
                        NSLog(@"coin: %@", coin);

                        NSArray* equipageArray = [awardInfo objectForKey:@"equipage"];
                        if ((equipageArray != nil)
                            && (![equipageArray isEqual:[NSNull null]])
                            && (![equipageArray isEqual:@""]))
                        {
                            NSLog(@"equipageArray: %@", equipageArray);

                            int count = [equipageArray count];
                            for (int i=0; i<count; i++)
                            {
                                NSArray* equipage = [equipageArray objectAtIndex:i];
                                if ((equipage != nil)
                                    && (![equipage isEqual:[NSNull null]])
                                    && (![equipage isEqual:@""]))
                                {
                                    EquipInfo* equipInfo = new EquipInfo();
                                    _parseEquipageInfo(equipage, equipInfo);
                                    ItemProxy::getSingletonPtr()->addEquip(equipInfo);
                                }
                                else
                                {
                                    //TODO: 解析出错
                                    NSLog(@"NetController::_parseDungeonExplore(): equipage[%i] is null.", i);
                                }
                            }
                        }
                        else
                        {
                            //TODO: 解析出错
                            NSLog(@"NetController::_parseDungeonExplore(): equipageArray is null.");
                        }
                    }
                    else
                    {
                        //TODO: 解析出错
                        NSLog(@"NetController::_parseDungeonExplore(): awardInfo is null.");
                    }

                    FightProxy::getSingletonPtr()->battleInfo.win = 0;
                    NSDictionary* battleInfo = [data objectForKey:@"battle"];
                    if ((battleInfo != nil)
                        && (![battleInfo isEqual:[NSNull null]])
                        && (![battleInfo isEqual:@""]))
                    {
                        NSDictionary* bossInfo = [battleInfo objectForKey:@"boss"];
                        if ((bossInfo != nil)
                            && (![bossInfo isEqual:[NSNull null]])
                            && (![bossInfo isEqual:@""]))
                        {
                            NSNumber* bossLevel = [bossInfo objectForKey:@"level"];
                            NSNumber* bossLife = [bossInfo objectForKey:@"life"];
                            NSNumber* bossAtkMin = [bossInfo objectForKey:@"atkMin"];
                            NSNumber* bossAtkMax = [bossInfo objectForKey:@"atkMax"];
                            NSNumber* bossDefMin = [bossInfo objectForKey:@"defMin"];
                            NSNumber* bossDefMax = [bossInfo objectForKey:@"defMax"];
                        }
                        else {
                            NSLog(@"NetController::_parseDungeonExplore(): bossInfo is null.");
                        }

                        NSArray* roundInfo = [battleInfo objectForKey:@"round"];
                        if ((roundInfo != nil)
                            && (![roundInfo isEqual:[NSNull null]])
                            && (![roundInfo isEqual:@""]))
                        {
                            int count = [roundInfo count];
                            for (int i=0; i<count; i++) {
                                NSArray* round = [roundInfo objectAtIndex:i];
                                if ((round != nil)
                                    && (![round isEqual:[NSNull null]])
                                    && (![round isEqual:@""]))
                                {
                                    NSNumber* atkUsr = [round objectAtIndex:0];  //1: 玩家为攻击方, 2: boss为攻击方
                                    NSNumber* atkMax = [round objectAtIndex:1];  //是否发生了最大攻击 1: 发生了最大攻击力， 0：没发生最大攻击力
                                    NSNumber* defMax = [round objectAtIndex:2];  //是否发生了最大防御 1: 发生了最大防御力， 0：没发生最大防御力
                                    NSNumber* life = [round objectAtIndex:3];    //攻击对于life造成的伤害
                                }
                                else {
                                    NSLog(@"NetController::_parseDungeonExplore(): round is null.");
                                }
                            }
                        }
                        else {
                            NSLog(@"NetController::_parseDungeonExplore(): roundInfo is null.");
                        }

                        NSNumber* win = [battleInfo objectForKey:@"win"];  //1: 玩家为获胜方, 2: boss为获胜方
                        FightProxy::getSingletonPtr()->battleInfo.win = [win intValue];
                    }
                    else
                    {
                        NSLog(@"NetController::_parseDungeonExplore(): battleInfo is null.");
                    }

                    NSDictionary* playerInfo = [data objectForKey:@"player"];
                    if ((playerInfo != nil)
                        && (![playerInfo isEqual:[NSNull null]])
                        && (![playerInfo isEqual:@""]))
                    {
                        NSNumber* energyCur = [playerInfo objectForKey:@"energyCur"];
                        NSNumber* coin = [playerInfo objectForKey:@"coin"];
                        NSNumber* level = [playerInfo objectForKey:@"level"];
                        NSNumber* exp = [playerInfo objectForKey:@"exp"];
                        UserVO& userVO = UserProxy::getSingletonPtr()->userVO;
                        userVO.energyCur = [energyCur intValue];
                        userVO.coin = [coin intValue];
                        userVO.level = [level intValue];
                        userVO.exp = [exp intValue];

                        NSLog(@"energyCur: %@", energyCur);
                        NSLog(@"coin: %@", coin);
                        NSLog(@"level: %@", level);
                        NSLog(@"exp: %@", exp);
                    }
                    else
                    {
                        NSLog(@"NetController::_parseDungeonExplore(): awardInfo is null.");
                    }
                }
                break;
            case 2:
                {
                    //TODO: 探险失败
                    NSLog(@"NetController::_parseDungeonExplore(): result is 2.");
                }
                break;

            default:
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseDungeonExplore(): unknow result.");
                }
            }
        }
    }

    NSLog(@"NetController::_parseDungeonExplore() end");
    Post_Net_Notification(kNCDungeonExplore, NULL);
}

/**
 * @brief     潜能点分配命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseAllotProficiency(void* params)
{
    NSLog(@"NetController::_parseAllotProficiency() start");


    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* proficiency = [data objectForKey:@"proficiency"];
        NSNumber* life = [data objectForKey:@"life"];
        NSNumber* energyCur = [data objectForKey:@"energyCur"];

        NSLog(@"proficiency: %@", proficiency);
        NSLog(@"life: %@", life);
        NSLog(@"energyCur: %@", energyCur);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseAllotProficiency(): data is null.");
    }

    NSLog(@"NetController::_parseAllotProficiency() end");
}

/**
 * @brief     装载装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseLoadEquipage(void* params)
{
    NSLog(@"NetController::_parseLoadEquipage() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* result = [data objectForKey:@"result"];
        if ((result != nil)
            && (![result isEqual:[NSNull null]])
            && (![result isEqual:@""]))
        {
            if ([result intValue] == 1)
            {
                //TODO: 装备成功
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::_parseLoadEquipage(): unknow result.");
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseLoadEquipage(): data is null.");
        }
        ItemProxy::getSingletonPtr()->putOnEquip(ItemProxy::getSingletonPtr()->putonIndex);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseLoadEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseLoadEquipage() end");
    Post_Net_Notification(kNCLoadEquipage, NULL);
}

/**
 * @brief     卸载装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseUnloadEquipage(void* params)
{
    NSLog(@"NetController::_parseUnloadEquipage() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* result = [data objectForKey:@"result"];
        if ((result != nil)
            && (![result isEqual:[NSNull null]])
            && (![result isEqual:@""]))
        {
            if ([result intValue] == 1)
            {
                //TODO: 卸载成功
            }
            else
            {
                //TODO: 解析出错
                NSLog(@"NetController::_parseUnloadEquipage(): unknow result.");
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseUnloadEquipage(): data is null.");
        }
        ItemProxy::getSingletonPtr()->takeOffEquip(ItemProxy::getSingletonPtr()->putonIndex);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseUnloadEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseUnloadEquipage() end");
    Post_Net_Notification(kNCUnloadEquipage, NULL);
}

/**
 * @brief     贩卖装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseSellEquipage(void* params)
{
    NSLog(@"NetController::_parseSellEquipage() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* sellCoin = [data objectForKey:@"sellCoin"];
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseUnloadEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseSellEquipage() end");
    Post_Net_Notification(kNCSellEquipage, NULL);
}

/**
 * @brief     洗练装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseResetEquipage(void* params)
{
    NSLog(@"NetController::_parseResetEquipage() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSArray* equipage = [data objectForKey:@"equipage"];
        if ((equipage != nil)
            && (![equipage isEqual:[NSNull null]])
            && (![equipage isEqual:@""]))
        {
            EquipInfo equipInfo;
            _parseEquipageInfo(equipage, &equipInfo);
            ItemProxy::getSingletonPtr()->addEquip(&equipInfo);
            ItemProxy::getSingletonPtr()->setLastQiangHuaEquip(ItemProxy::getSingletonPtr()->getEquip(equipInfo.index));
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseGetSelfInfo(): equipage[%@] is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseResetEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseResetEquipage() end");
    Post_Net_Notification(kNCResetEquipage, NULL);
}

/**
 * @brief     熔炼装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseFusionEquipage(void* params)
{
    NSLog(@"NetController::_parseFusionEquipage() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* fusion = [data objectForKey:@"fusion"];
        vector<int>& items = ItemProxy::getSingletonPtr()->mSelectList;
        for(int i = 0; i < items.size(); i++)
            ItemProxy::getSingletonPtr()->removeEquip(items[i]);
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseFusionEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseFusionEquipage() end");
    Post_Net_Notification(kNCFusionEquipage, NULL);
}

/**
 * @brief     强化装备命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseIntensifyEquipage(void* params)
{
    NSLog(@"NetController::_parseIntensifyEquipage() start");


    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSNumber* coin = [data objectForKey:@"coin"];
        NSNumber* energyCur = [data objectForKey:@"energyCur"];
        NSNumber* fusion = [data objectForKey:@"fusion"];
        UserVO& userVO = UserProxy::getSingletonPtr()->userVO;
        userVO.coin = [coin intValue];
        userVO.energyCur = [energyCur intValue];
        userVO.fusion = [fusion intValue];

        NSArray* equipage = [data objectForKey:@"equipage"];
        if ((equipage != nil)
            && (![equipage isEqual:[NSNull null]])
            && (![equipage isEqual:@""]))
        {
            EquipInfo equipInfo;
            _parseEquipageInfo(equipage, &equipInfo);
            ItemProxy::getSingletonPtr()->addEquip(&equipInfo, true);
            ItemProxy::getSingletonPtr()->curQiangHuaEquip = ItemProxy::getSingletonPtr()->getEquip(equipInfo.index);
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseIntensifyEquipage(): intensifyEquipage is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseIntensifyEquipage(): data is null.");
    }

    NSLog(@"NetController::_parseIntensifyEquipage() end");
    Post_Net_Notification(kNCIntensifyEquipage, NULL);
}

/**
 * @brief     查找挑战玩家信息命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseFindChallengePlayer(void* params)
{
    NSLog(@"NetController::_parseFindChallengePlayer() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        ChanllengeProxy::getSingletonPtr()->clearChallengeEnemyList();
        ChallengeEnemyList& challengeEnemyList = ChanllengeProxy::getSingletonPtr()->mChallengeEnemyList;
        NSArray* playerList = [data objectForKey:@"playerList"];
        if ((playerList != nil)
            && (![playerList isEqual:[NSNull null]])
            && (![playerList isEqual:@""]))
        {
            int count = [playerList count];
            for (int i=0; i<count; i++)
            {
                NSDictionary* player = [playerList objectAtIndex:i];
                if ((player != nil)
                    && (![player isEqual:[NSNull null]])
                    && (![player isEqual:@""]))
                {
                    
                    ChallengeEnemyInfo* challengeEnemyInfo = new ChallengeEnemyInfo();
                    _parseChallengeEnemyInfo(player, challengeEnemyInfo, false);
                    challengeEnemyList.push_back(challengeEnemyInfo);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseFindChallengePlayer(): player is null.");
                }
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseIntensifyEquipage(): playerList is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseFindChallengePlayer(): data is null.");
    }

    NSLog(@"NetController::_parseFindChallengePlayer() end");
    Post_Net_Notification(kNCFindChallengePlayer, NULL);
}

/**
 * @brief     获取挑战玩家列表信息命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGetChallengeList(void* params)
{
    NSLog(@"NetController::_parseGetChallengeList() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        ChanllengeProxy::getSingletonPtr()->clearChallengeEnemyList();
        ChallengeEnemyList& challengeEnemyList = ChanllengeProxy::getSingletonPtr()->mChallengeEnemyList;
        NSArray* playerList = [data objectForKey:@"playerList"];
        if ((playerList != nil)
            && (![playerList isEqual:[NSNull null]])
            && (![playerList isEqual:@""]))
        {
            int count = [playerList count];
            for (int i=0; i<count; i++)
            {
                NSDictionary* player = [playerList objectAtIndex:i];
                if ((player != nil)
                    && (![player isEqual:[NSNull null]])
                    && (![player isEqual:@""]))
                {
                    ChallengeEnemyInfo* challengeEnemyInfo = new ChallengeEnemyInfo();
                    _parseChallengeEnemyInfo(player, challengeEnemyInfo, false);
                    challengeEnemyList.push_back(challengeEnemyInfo);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseGetChallengeList(): player is null.");
                }
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseGetChallengeList(): playerList is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseGetChallengeList(): data is null.");
    }

    NSLog(@"NetController::_parseGetChallengeList() end");
    Post_Net_Notification(kNCGetChallengeList, NULL);
}

/**
 * @brief     获取挑战宿敌列表信息命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseGetChallengeEnemyList(void* params) {
    NSLog(@"NetController::_parseGetChallengeEnemyList() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        ChanllengeProxy::getSingletonPtr()->clearChallengeEnemyList();
        ChallengeEnemyList& challengeEnemyList = ChanllengeProxy::getSingletonPtr()->mChallengeEnemyList;
        NSArray* playerList = [data objectForKey:@"challengeEnemyList"];
        if ((playerList != nil)
            && (![playerList isEqual:[NSNull null]])
            && (![playerList isEqual:@""]))
        {
            int count = [playerList count];
            for (int i=0; i<count; i++)
            {
                NSDictionary* player = [playerList objectAtIndex:i];
                if ((player != nil)
                    && (![player isEqual:[NSNull null]])
                    && (![player isEqual:@""]))
                {
                    ChallengeEnemyInfo* challengeEnemyInfo = new ChallengeEnemyInfo();
                    this->_parseChallengeEnemyInfo(player, challengeEnemyInfo);
                    challengeEnemyList.push_back(challengeEnemyInfo);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseGetChallengeEnemyList(): player is null.");
                }
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseGetChallengeEnemyList(): playerList is null.");
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseGetChallengeEnemyList(): data is null.");
    }

    NSLog(@"NetController::_parseGetChallengeEnemyList() end");
    Post_Net_Notification(kNCGetChallengeEnemyList, NULL);
}

/**
 * @brief     挑战命令返回数据解析函数。
 * @param[in] params 接收到的数据。
 */
void NetController::_parseChallengePlayer(void* params)
{
    NSLog(@"NetController::_parseChallengePlayer() start");

    NSDictionary* data = (NSDictionary*)params;
    if ((data != nil)
        && (![data isEqual:[NSNull null]])
        && (![data isEqual:@""]))
    {
        NSDictionary* challenge = [data objectForKey:@"challenge"];
        if ((challenge != nil)
            && (![challenge isEqual:[NSNull null]])
            && (![challenge isEqual:@""]))
        {
            //验证信息
            NSNumber* win = [challenge objectForKey:@"win"];  //1: 玩家为获胜方, 2: 对手为获胜方
            NSArray* roundInfo = [challenge objectForKey:@"round"];
            ChallengeResult& mChallengeResult = ChanllengeProxy::getSingletonPtr()->mChallengeResult;
            mChallengeResult.result = [win intValue];
            if ((roundInfo != nil)
                && (![roundInfo isEqual:[NSNull null]])
                && (![roundInfo isEqual:@""]))
            {
                int count = [roundInfo count];
                for (int i=0; i<count; i++) {
                    NSArray* round = [roundInfo objectAtIndex:i];
                    if ((round != nil)
                        && (![round isEqual:[NSNull null]])
                        && (![round isEqual:@""]))
                    {
                        NSNumber* atkUsr = [round objectAtIndex:0];  //1: 玩家为攻击方, 2: 对手为攻击方
                        NSNumber* atkMax = [round objectAtIndex:1];  //是否发生了最大攻击 1: 发生了最大攻击力， 0：没发生最大攻击力
                        NSNumber* defMax = [round objectAtIndex:2];  //是否发生了最大防御 1: 发生了最大防御力， 0：没发生最大防御力
                        NSNumber* life = [round objectAtIndex:3];    //攻击对于life造成的伤害
                    }
                    else {
                        NSLog(@"NetController::_parseChallengePlayer(): round is null.");
                    }
                }
            }
            else {
                NSLog(@"NetController::_parseChallengePlayer(): roundInfo is null.");
            }

        }
        else {
            //TODO: 解析出错
            NSLog(@"NetController::_parseChallengePlayer(): challenge is null.");
        }


        NSNumber* succeedExp = [data objectForKey:@"succeedExp"];
        NSNumber* succeedGold = [data objectForKey:@"succeedGold"];
        NSNumber* failedGold = [data objectForKey:@"failedGold"];
        ChanllengeProxy::getSingletonPtr()->curChallengeEnemyInfo->succeedExp=[succeedExp intValue];
        ChanllengeProxy::getSingletonPtr()->curChallengeEnemyInfo->succeedGold=[succeedGold intValue];
        ChanllengeProxy::getSingletonPtr()->curChallengeEnemyInfo->failedGold=[failedGold intValue];

        NSDictionary* asyncInfo = [data objectForKey:@"asyncInfo"];
        if ((asyncInfo != nil)
            && (![asyncInfo isEqual:[NSNull null]])
            && (![asyncInfo isEqual:@""]))
        {
            NSNumber* coin = [asyncInfo objectForKey:@"coin"];
            NSNumber* level = [asyncInfo objectForKey:@"level"];
            NSNumber* exp = [asyncInfo objectForKey:@"exp"];
            NSNumber* energyCur = [asyncInfo objectForKey:@"energyCur"];
            NSNumber* energyMax = [asyncInfo objectForKey:@"energyMax"];
            NSNumber* powerCur = [asyncInfo objectForKey:@"powerCur"];
            NSNumber* powerMax = [asyncInfo objectForKey:@"powerMax"];
            NSNumber* energyTime = [asyncInfo objectForKey:@"energyTime"];
            NSNumber* powerTime = [asyncInfo objectForKey:@"powerTime"];
            UserVO& userVO = UserProxy::getSingletonPtr()->userVO;
            userVO.coin = [coin intValue];
            userVO.level = [level intValue];
            userVO.exp = [exp intValue];
            userVO.energyCur = [energyCur intValue];
            userVO.energyMax = [energyMax intValue];
            userVO.powerCur = [powerCur intValue];
            userVO.powerMax = [powerMax intValue];
            userVO.energyTime = [energyTime intValue];
            userVO.powerTime = [powerTime intValue];
        }
    }
    else
    {
        //TODO: 解析出错
        NSLog(@"NetController::_parseChallengePlayer(): data is null.");
    }

    NSLog(@"NetController::_parseChallengePlayer() end");
    Post_Net_Notification(kNCChallengePlayer, NULL);
}

/**
 * @brief  取得PID函数。
 * @return PID。
 */
std::string NetController::_getPid()
{
    NSLog(@"NetController::_getPid() start");
    NSLog(@"NetController::_getPid() end");
//    return getDeviceID();

    // TODO: pid要取得方法
    return "11111129";
}

/**
 * @brief  取得平台类型函数。
 * @return 平台类型。
 */
int NetController::_getPlatform()
{
    NSLog(@"NetController::_getPlatform() start");
    NSLog(@"NetController::_getPlatform() end");

    return kNCPlatform;
}

/**
 * @brief  取得网络命令版本号函数。
 * @return 网络命令版本号。
 */
std::string NetController::_getVersion()
{
    NSLog(@"NetController::_getVersion() start");
    NSLog(@"NetController::_getVersion() end");

    return kNCVersion;
}

/**
 * @brief      解析装备函数。
 * @param[in]  data 装备数据。
 * @param[out] info 装备信息。
 */
void NetController::_parseEquipageInfo(void* data, void* info)
{
    NSLog(@"NetController::_parseEquipageInfo() start");

    NSArray* arrayData = (NSArray*)data;

    if ((arrayData != nil)
        && (![arrayData isEqual:[NSNull null]])
        && (![arrayData isEqual:@""])
        && (info != NULL))
    {
        NSNumber* equipageIndex = [arrayData objectAtIndex:kNCBagEquipageFieldIndex];
        NSNumber* equipageID = [arrayData objectAtIndex:kNCBagEquipageFieldBaseID];
        NSNumber* equipageLevel = [arrayData objectAtIndex:kNCBagEquipageFieldLevel];
        NSNumber* equipageExp = [arrayData objectAtIndex:kNCBagEquipageFieldExp];
        NSNumber* equipageAtkMin = [arrayData objectAtIndex:kNCBagEquipageFieldAtkMin];
        NSNumber* equipageAtkMax = [arrayData objectAtIndex:kNCBagEquipageFieldAtkMax];
        NSNumber* equipageDefMin = [arrayData objectAtIndex:kNCBagEquipageFieldDefMin];
        NSNumber* equipageDefMax = [arrayData objectAtIndex:kNCBagEquipageFieldDefMax];
        NSNumber* equipageLife = [arrayData objectAtIndex:kNCBagEquipageFieldLife];
        NSNumber* equipageState = [arrayData objectAtIndex:kNCBagEquipageFieldState];
        NSNumber* equipageIntensifyNum = [arrayData objectAtIndex:kNCBagEquipageFieldIntensifyNum];
        NSNumber* equipageIntensifyValue = [arrayData objectAtIndex:kNCBagEquipageFieldIntensifyValue];
        NSArray* equipageExt = [arrayData objectAtIndex:kNCBagEquipageFieldExt];
        int count = [equipageExt count];
        for (int j=0; j<count; j++) {
            //TODO: 词条解析
        }

        ((EquipInfo*)info)->index = [equipageIndex intValue];
        ((EquipInfo*)info)->id = [equipageID intValue];
        ((EquipInfo*)info)->level = [equipageLevel intValue];
        ((EquipInfo*)info)->exp = [equipageExp intValue];
        ((EquipInfo*)info)->atkMin = [equipageAtkMin intValue];
        ((EquipInfo*)info)->atkMax = [equipageAtkMax intValue];
        ((EquipInfo*)info)->defMin = [equipageDefMin intValue];
        ((EquipInfo*)info)->defMax = [equipageDefMax intValue];
        ((EquipInfo*)info)->life = [equipageLife intValue];
        ((EquipInfo*)info)->state = [equipageState intValue];
        ((EquipInfo*)info)->intensifyNum = [equipageIntensifyNum intValue];
        ((EquipInfo*)info)->intensifyValue = [equipageIntensifyValue intValue];
    }

    NSLog(@"NetController::_parseEquipageInfo() end");
}

/**
 * @brief      解析道具函数。
 * @param[in]  data 道具数据。
 * @param[out] info 道具信息。
 */
void NetController::_parsePropInfo(void* data, void* info)
{
    NSLog(@"NetController::_parsePropInfo() start");

    NSArray* arrayData = (NSArray*)data;

    if ((arrayData != nil)
        && (![arrayData isEqual:[NSNull null]])
        && (![arrayData isEqual:@""])
        && (info != NULL))
    {
        NSNumber* propIndex = [arrayData objectAtIndex:kNCBagPropFieldIndex];
        NSNumber* propID = [arrayData objectAtIndex:kNCBagPropFieldBaseID];
        NSNumber* propNum = [arrayData objectAtIndex:kNCBagPropFieldNum];

        ((ItemInfo*)info)->index = [propIndex intValue];
        ((ItemInfo*)info)->id = [propID intValue];
        ((ItemInfo*)info)->count = [propNum intValue];
    }

    NSLog(@"NetController::_parsePropInfo() end");
}

/**
 * @brief      解析任务函数。
 * @param[in]  data 任务数据。
 * @param[out] info 任务信息。
 */
void NetController::_parseTaskInfo(void* data, void* info)
{
    NSLog(@"NetController::_parseTaskInfo() start");

    NSArray* arrayData = (NSArray*)data;

    if ((arrayData != nil)
        && (![arrayData isEqual:[NSNull null]])
        && (![arrayData isEqual:@""])
        && (info != NULL))
    {
        NSNumber* floor = [arrayData objectAtIndex:kNCTaskFieldFloor];
        NSNumber* task = [arrayData objectAtIndex:kNCTaskFieldTask];
        NSNumber* progress = [arrayData objectAtIndex:kNCTaskFieldProgress];

        ((TaskInfo*)info)->floor = [floor intValue];
        ((TaskInfo*)info)->task = [task intValue];
        ((TaskInfo*)info)->progress = [progress intValue];
    }

    NSLog(@"NetController::_parseTaskInfo() end");
}

/**
 * @brief      解析挑战宿敌函数。
 * @param[in]  data 挑战宿敌数据。
 * @param[out] info 挑战宿敌信息。
 */
void NetController::_parseChallengeEnemyList(void* data, void* info)
{
    NSLog(@"NetController::_parseChallengeEnemyList() start");

    NSDictionary* arrayData = (NSDictionary*)data;

    if ((arrayData != nil)
        && (![arrayData isEqual:[NSNull null]])
        && (![arrayData isEqual:@""])
        && (info != NULL))
    {
//        NSNumber* gid = [arrayData objectForKey:@'gid'];
//        NSString* name = [arrayData objectForKey:@'name'];
//        NSNumber* time = [arrayData objectForKey:@'time'];
//        NSNumber* coin = [arrayData objectForKey:@'coin'];

        //TODO: 上层对应
    }

    NSLog(@"NetController::_parseChallengeEnemyList() end");
}

void NetController::_parseChallengeEnemyInfo(void* data, void* info, bool isParseEnemy)
{
    NSLog(@"NetController::_parseChallengeEnemyInfo() start");

    NSDictionary* player = (NSDictionary*)data;
    if ((player != nil)
        && (![player isEqual:[NSNull null]])
        && (![player isEqual:@""])
        && (info != NULL)) {
        NSNumber* gid = [player objectForKey:@"gid"];
        NSString* name = [player objectForKey:@"name"];
        NSNumber* sex = [player objectForKey:@"sex"];
        NSNumber* avata = [player objectForKey:@"avata"];
        NSNumber* level = [player objectForKey:@"level"];
        NSNumber* exp = [player objectForKey:@"exp"];
        NSNumber* atkMin = [player objectForKey:@"atkMin"];
        NSNumber* atkMax = [player objectForKey:@"atkMax"];
        NSNumber* defMin = [player objectForKey:@"defMin"];
        NSNumber* defMax = [player objectForKey:@"defMax"];
        NSNumber* succeedExp = [player objectForKey:@"succeedExp"];
        NSNumber* succeedGold = [player objectForKey:@"succeedGold"];
        NSNumber* failedGold = [player objectForKey:@"failedGold"];

        ChallengeEnemyInfo* challengeEnemyInfo = (ChallengeEnemyInfo*)info;
        challengeEnemyInfo->gid = [gid intValue];
        challengeEnemyInfo->name = [name UTF8String];
//        challengeEnemyInfo->sex = [sex intValue];
        challengeEnemyInfo->avatar = [avata intValue];
        challengeEnemyInfo->level = [level intValue];
        challengeEnemyInfo->atkMin = [atkMin intValue];
        challengeEnemyInfo->atkMax = [atkMax intValue];
        challengeEnemyInfo->succeedExp = [succeedExp intValue];
        challengeEnemyInfo->succeedGold = [succeedGold intValue];
        challengeEnemyInfo->failedGold = [failedGold intValue];

        NSLog(@"gid: %@", gid);
        NSLog(@"name: %@", name);
        NSLog(@"sex: %@", sex);
        NSLog(@"avata: %@", avata);
        NSLog(@"level: %@", level);
        NSLog(@"exp: %@", exp);
        NSLog(@"atkMin: %@", atkMin);
        NSLog(@"atkMax: %@", atkMax);
        NSLog(@"defMin: %@", defMin);
        NSLog(@"defMax: %@", defMax);
        NSLog(@"succeedExp: %@", succeedExp);
        NSLog(@"succeedGold: %@", succeedGold);
        NSLog(@"failedGold: %@", failedGold);
        if(isParseEnemy)
        {
            NSNumber* challengeTime = [player objectForKey:@"challengeTime"];
            NSNumber* challengeCoin = [player objectForKey:@"challengeCoin"];
            challengeEnemyInfo->time = [challengeTime intValue];
            challengeEnemyInfo->gold = [challengeCoin intValue];
            NSLog(@"challengeTime: %@", challengeTime);
            NSLog(@"challengeCoin: %@", challengeCoin);
        }
    }
}

void NetController::_getSelfInfo(void* params)
{
    NSDictionary* data = (NSDictionary*)params;
    NSDictionary* player = [data objectForKey:@"player"];
    if ((player != nil)
        && (![player isEqual:[NSNull null]])
        && (![player isEqual:@""]))
    {
        //验证信息
        NSNumber* gid = [player objectForKey:@"gid"];
        NSString* pid = [player objectForKey:@"pid"];
        NSNumber* platform = [player objectForKey:@"platform"];
        
        UserVO& userVO = UserProxy::getSingletonPtr()->userVO;
        userVO.gid = [gid intValue];
        userVO.pid = [pid UTF8String];
        userVO.platform = [platform intValue];
        
        //取得gid
        mGid = [gid intValue];
        
        NSLog(@"gid: %@", gid);
        NSLog(@"pid: %@", pid);
        NSLog(@"platform: %@", platform);
        
        //时间信息
        NSNumber* createTime = [player objectForKey:@"createTime"];
        NSNumber* energyTime = [player objectForKey:@"energyTime"];
        NSNumber* powerTime = [player objectForKey:@"powerTime"];
        userVO.createTime = [createTime intValue];
        userVO.energyTime = [energyTime intValue];
        userVO.powerTime = [powerTime intValue];
        
        NSLog(@"createTime: %@", createTime);
        NSLog(@"energyTime: %@", energyTime);
        NSLog(@"powerTime: %@", powerTime);
        
        //基础信息
        NSString* name = [player objectForKey:@"name"];
        NSString* sex = [player objectForKey:@"sex"];
        NSNumber* avata = [player objectForKey:@"avata"];
        NSNumber* level = [player objectForKey:@"level"];
        NSNumber* exp = [player objectForKey:@"exp"];
        userVO.name = [name UTF8String];
        userVO.sex = [sex intValue];
        userVO.avatar = [avata intValue];
        userVO.level = [level intValue];
        userVO.exp = [exp intValue];
        
        NSLog(@"name: %@", name);
        NSLog(@"sex: %@", sex);
        NSLog(@"avata: %@", avata);
        NSLog(@"level: %@", level);
        NSLog(@"exp: %@", exp);
        
        //金融信息
        NSNumber* coin = [player objectForKey:@"coin"];
        NSNumber* money = [player objectForKey:@"money"];
        userVO.coin = [coin intValue];
        userVO.money = [money intValue];
        
        NSLog(@"coin: %@", coin);
        NSLog(@"money: %@", money);
        
        //能力信息
        NSNumber* energyCur = [player objectForKey:@"energyCur"];
        NSNumber* energyMax = [player objectForKey:@"energyMax"];
        NSNumber* powerCur = [player objectForKey:@"powerCur"];
        NSNumber* powerMax = [player objectForKey:@"powerMax"];
        NSNumber* life = [player objectForKey:@"life"];
        NSNumber* proficiency = [player objectForKey:@"proficiency"];
        NSNumber* fusion = [player objectForKey:@"fusion"];
        userVO.energyCur = [energyCur intValue];
        userVO.energyMax = [energyMax intValue];
        userVO.powerCur = [powerCur intValue];
        userVO.powerMax = [powerMax intValue];
        userVO.life = [life intValue];
        userVO.proficiency = [proficiency intValue];
        userVO.fusion = [fusion intValue];
        
        NSLog(@"energyCur: %@", energyCur);
        NSLog(@"energyMax: %@", energyMax);
        NSLog(@"powerCur: %@", powerCur);
        NSLog(@"powerMax: %@", powerMax);
        NSLog(@"life: %@", life);
        NSLog(@"proficiency: %@", proficiency);
        NSLog(@"fusion: %@", fusion);
        
        //对战信息
        NSNumber* atkMin = [player objectForKey:@"atkMin"];
        NSNumber* atkMax = [player objectForKey:@"atkMax"];
        NSNumber* defMin = [player objectForKey:@"defMin"];
        NSNumber* defMax = [player objectForKey:@"defMax"];
        NSNumber* atkMaxReappear = [player objectForKey:@"atkMaxReappear"];
        NSNumber* defMaxReappear = [player objectForKey:@"defMaxReappear"];
        NSNumber* expGainRatio = [player objectForKey:@"expGainRatio"];
        NSNumber* coinGainRatio = [player objectForKey:@"coinGainRatio"];
        NSNumber* equipageDropRatio = [player objectForKey:@"equipageDropRatio"];
        NSNumber* energyRecoverRatio = [player objectForKey:@"energyRecoverRatio"];
        NSNumber* powerRecoverRatio = [player objectForKey:@"powerRecoverRatio"];
        userVO.atkMin = [atkMin intValue];
        userVO.atkMax = [atkMax intValue];
        userVO.defMin = [defMin intValue];
        userVO.defMax = [defMax intValue];
        userVO.atkMaxReappear = [atkMaxReappear intValue];
        userVO.defMaxReappear = [defMaxReappear intValue];
        userVO.expGainRatio = [expGainRatio intValue];
        userVO.coinGainRatio = [coinGainRatio intValue];
        userVO.equipageDropRatio = [equipageDropRatio intValue];
        userVO.energyRecoverRatio = [energyRecoverRatio intValue];
        userVO.powerRecoverRatio = [powerRecoverRatio intValue];
        
        NSLog(@"atkMin: %@", atkMin);
        NSLog(@"atkMax: %@", atkMax);
        NSLog(@"defMin: %@", defMin);
        NSLog(@"defMax: %@", defMax);
        NSLog(@"atkMaxReappear: %@", atkMaxReappear);
        NSLog(@"defMaxReappear: %@", defMaxReappear);
        NSLog(@"expGainRatio: %@", expGainRatio);
        NSLog(@"coinGainRatio: %@", coinGainRatio);
        NSLog(@"equipageDropRatio: %@", equipageDropRatio);
        NSLog(@"energyRecoverRatio: %@", energyRecoverRatio);
        NSLog(@"powerRecoverRatio: %@", powerRecoverRatio);
        
        //装备背包信息
        NSNumber* equipageBagItemMax = [player objectForKey:@"equipageBagItemMax"];
        NSNumber* equipageBagItemCurID = [player objectForKey:@"equipageBagItemCurID"];
        NSArray* equipageBagItemArray = [player objectForKey:@"equipageBagItemArray"];
        if ((equipageBagItemArray != nil)
            && (![equipageBagItemArray isEqual:[NSNull null]])
            && (![equipageBagItemArray isEqual:@""]))
        {
            int count = [equipageBagItemArray count];
            for (int i=0; i<count; i++)
            {
                NSArray* equipage = [equipageBagItemArray objectAtIndex:i];
                if ((equipage != nil)
                    && (![equipage isEqual:[NSNull null]])
                    && (![equipage isEqual:@""]))
                {
                    EquipInfo* equipInfo = new EquipInfo();
                    _parseEquipageInfo(equipage, equipInfo);
                    ItemProxy::getSingletonPtr()->addEquip(equipInfo);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseRegist(): equipage[%@] is null.", i);
                }
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseRegist(): equipageBagItemArray is null.");
        }
        
        NSLog(@"equipageBagItemMax: %@", equipageBagItemMax);
        NSLog(@"equipageBagItemCurID: %@", equipageBagItemCurID);
        NSLog(@"equipageBagItemArray: %@", equipageBagItemArray);
        
        NSArray* propBagItemArray = [player objectForKey:@"propBagItemArray"];
        if ((propBagItemArray != nil)
            && (![propBagItemArray isEqual:[NSNull null]])
            && (![propBagItemArray isEqual:@""]))
        {
            int count = [propBagItemArray count];
            for (int i=0; i<count; i++)
            {
                NSArray* prop = [propBagItemArray objectAtIndex:i];
                if ((prop != nil)
                    && (![prop isEqual:[NSNull null]])
                    && (![prop isEqual:@""]))
                {
                    ItemInfo* itemInfo = new ItemInfo();
                    _parsePropInfo(prop, itemInfo);
                    ItemProxy::getSingletonPtr()->addItem(itemInfo);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseRegist(): prop[%@] is null.", i);
                }
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseRegist(): propBagItemArray is null.");
        }
        
        NSLog(@"propBagItemArray: %@", propBagItemArray);
        
        NSDictionary* taskCur = [player objectForKey:@"taskCur"];
        if ((taskCur != nil)
            && (![taskCur isEqual:[NSNull null]])
            && (![taskCur isEqual:@""]))
        {
            NSArray* keys = [taskCur allKeys];
            for (int i=0; i<[keys count]; i++)
            {
                NSNumber* key = [keys objectAtIndex:i];
                NSArray* taskInfo = [taskCur objectForKey:key];
                
                DungeonsProxy::getSingletonPtr()->curTaskInfo.dungeonID = [key intValue];
                _parseTaskInfo(taskInfo, &(DungeonsProxy::getSingletonPtr()->curTaskInfo));
            }
        }
        else
        {
            //TODO: 解析出错
            NSLog(@"NetController::_parseRegist(): taskCur is null.");
        }
        
        NSLog(@"taskCur: %@", taskCur);
        
        NSDictionary* taskMax = [player objectForKey:@"taskMax"];
        if ((taskMax != nil)
            && (![taskMax isEqual:[NSNull null]])
            && (![taskMax isEqual:@""]))
        {
            NSArray* keys = [taskMax allKeys];
            for (int i=0; i<[keys count]; i++)
            {
                NSNumber* key = [keys objectAtIndex:i];
                NSArray* taskInfo = [taskMax objectForKey:key];
                
                DungeonsProxy::getSingletonPtr()->curTaskInfo.dungeonID = [key intValue];
                _parseTaskInfo(taskInfo, &(DungeonsProxy::getSingletonPtr()->curTaskInfo));
            }
        }
        else{
            //TODO: 解析出错
            NSLog(@"NetController::_parseRegist(): taskMax is null.");
        }
        
        NSLog(@"taskMax: %@", taskMax);
        
        NSDictionary* challengeEnemyList = [player objectForKey:@"challengeEnemyList"];
        if ((challengeEnemyList != nil)
            && (![challengeEnemyList isEqual:[NSNull null]])
            && (![challengeEnemyList isEqual:@""]))
        {
            int count = [challengeEnemyList count];
            for (int i=0; i<count; i++)
            {
                NSArray* enemy = [challengeEnemyList objectAtIndex:i];
                if ((enemy != nil)
                    && (![enemy isEqual:[NSNull null]])
                    && (![enemy isEqual:@""]))
                {
                    //TODO: 上层对应
                    _parseChallengeEnemyList(enemy, NULL);
                }
                else
                {
                    //TODO: 解析出错
                    NSLog(@"NetController::_parseRegist(): enemy[%@] is null.", i);
                }
            }
        }
        else{
            //TODO: 解析出错
            NSLog(@"NetController::_parseRegist(): challengeEnemyList is null.");
        }
        
        NSLog(@"challengeEnemyList: %@", challengeEnemyList);
    }
}

#endif
